﻿<Page
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:JasRibbonApplicatie="clr-namespace:JasRibbonApplicatie" x:Class="JasRibbonApplicatie.Views.BeheerAanvragen.MateriaalAanvragen" 
      xmlns:src="clr-namespace:JasRibbonApplicatie.Converters"
      mc:Ignorable="d" 
      d:DesignHeight="800" d:DesignWidth="800"
	Title="MateriaalAanvragen">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <GroupBox Header="Materiaal" Margin="9,12,0,12" x:Name="materiaalGroupBox" VerticalAlignment="Stretch" HorizontalAlignment="Left">
            <Grid>
                    <DataGrid AutoGenerateColumns="false" x:Name="materiaalDataGrid" DataContext="{Binding}" HeadersVisibility="Column" SelectionMode="Single" SelectionUnit="FullRow" GridLinesVisibility="None" AlternatingRowBackground="#2A0059D9" BorderBrush="#00000000"  Background="White" CanUserResizeRows="False" UseLayoutRounding="False">
                        <DataGrid.Resources>
                            <src:ComboCountConverter x:Key="comboCountConverter"/>
                        </DataGrid.Resources>
                        <DataGrid.Columns>
                            <DataGridTextColumn Binding="{Binding MateriaalVolledig.Naam}" Header="Naam" IsReadOnly="True"/>
                            <DataGridTextColumn Binding="{Binding AantalAangevraagd}" IsReadOnly="True">
                                <DataGridTextColumn.Header>
                                    <Image Source="/JasRibbonApplicatie;component/Images/AanvraagBeheerIcons/aangevraagdIcon.png" Height="22" Width="22" HorizontalAlignment="Center" ToolTip="Aantal stuks aangevraagd" />
                                </DataGridTextColumn.Header>
                            </DataGridTextColumn>
                            <DataGridComboBoxColumn SelectedValueBinding="{Binding AantalGoedgekeurd, UpdateSourceTrigger=PropertyChanged}">
                                <DataGridComboBoxColumn.EditingElementStyle>
                                    <Style TargetType="ComboBox">
                                        <Setter Property="ItemsSource" Value="{Binding MateriaalVolledig.Aantal, Converter={StaticResource comboCountConverter}}" />
                                    </Style>
                                </DataGridComboBoxColumn.EditingElementStyle>
                                <DataGridComboBoxColumn.ElementStyle>
                                    <Style TargetType="ComboBox">
                                        <Setter Property="ItemsSource" Value="{Binding MateriaalVolledig.Aantal, Converter={StaticResource comboCountConverter}}" />
                                    </Style>
                                </DataGridComboBoxColumn.ElementStyle>
                                <DataGridComboBoxColumn.Header>
                                        <Image Source="/JasRibbonApplicatie;component/Images/AanvraagBeheerIcons/goedgekeurdIcon.png" Height="22" Width="22" HorizontalAlignment="Center" ToolTip="Aantal stuks goedgekeurd" />
                                    </DataGridComboBoxColumn.Header>
                            </DataGridComboBoxColumn>
                            <DataGridTextColumn Binding="{Binding MateriaalVolledig.AantalDefect}" IsReadOnly="True">
                                <DataGridTextColumn.Header>
                                    <Image Source="/JasRibbonApplicatie;component/Images/AanvraagBeheerIcons/repairIcon.png" Height="22" Width="22" HorizontalAlignment="Center" ToolTip="Aantal stuks in herstelling" />
                                </DataGridTextColumn.Header>
                            </DataGridTextColumn>
                            <DataGridTextColumn Binding="{Binding AantalReedsOntleend}" IsReadOnly="True">
                                <DataGridTextColumn.Header>
                                    <Image Source="/JasRibbonApplicatie;component/Images/AanvraagBeheerIcons/aantalIcon.png" Height="22" Width="22" HorizontalAlignment="Center" ToolTip="Aantal ontleend" />
                                </DataGridTextColumn.Header>
                            </DataGridTextColumn>
                            <DataGridTextColumn Binding="{Binding MateriaalVolledig.Aantal}" IsReadOnly="True">
                                <DataGridTextColumn.Header>
                                    <Image Source="/JasRibbonApplicatie;component/Images/AanvraagBeheerIcons/aantalIcon.png" Height="22" Width="22" HorizontalAlignment="Center" ToolTip="Totaal aantal" />
                                </DataGridTextColumn.Header>
                            </DataGridTextColumn>
                        </DataGrid.Columns>
                    </DataGrid>
                </Grid>
        </GroupBox>
        <GroupBox Grid.Column="1" x:Name="materiaalToevoegenGroupBox" Header="Materiaal Toevoegen" HorizontalAlignment="Left" Margin="0,12,0,0" Height="auto" VerticalAlignment="Top">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                <JasRibbonApplicatie:MateriaalPicker Grid.Row="0" x:Name="materiaalPicker" VerticalAlignment="Top" Width="400" />
                <Button Grid.Row="1" Name="MateriaalToevoegButton" Content="&lt;- Toevoegen" Click="MateriaalToevoegButton_Click" />
            </Grid>
        </GroupBox>
    </Grid>
</Page>
